package cn.edu.hbvtc.qms.service;

import java.util.List;

import org.springframework.security.core.userdetails.UserDetailsService;

import cn.edu.hbvtc.qms.domain.Clazz;
import cn.edu.hbvtc.qms.domain.Course;
import cn.edu.hbvtc.qms.domain.Department;
import cn.edu.hbvtc.qms.domain.Major;
import cn.edu.hbvtc.qms.domain.Role;
import cn.edu.hbvtc.qms.domain.Student;
import cn.edu.hbvtc.qms.domain.Term;
import cn.edu.hbvtc.qms.domain.Teacher;
import cn.edu.hbvtc.qms.domain.User;

public interface IManagementService extends UserDetailsService {

	/*
	 * Role对象的事务处理
	 */
	void saveRole(Role role);
	
	void deleteRoleById(int id);
	
	void updateRole(Role role);
	
	List<Role> findRoles();
	
	Role findRoleById(int id);
	
	Role findRoleByName(String name);
	
	/*
	 * User对象的事务处理
	 */
	void saveUser(User user);
	
	void deleteUserById(int id);
	
	void updateUser(User user);
	
	List<User> findUsers();
	
	User findUserById(int id);
	
	User findUserByUsername(String username);
	
	List<User> findUsersByRoleName(String roleName);
	
	/*
	 * Department对象的事务处理
	 */
	void saveDepartment(Department department);
	
	void deleteDepartmentById(int id);
	
	void updateDepartment(Department department);
	
	List<Department> findDepartments();
	
	Department findDepartmentById(int id);
	
	Department findDepartmentByDeptId(String deptId);
	
	/*
	 * Clazz对象的事务处理
	 */
	Integer saveClazz(Clazz clazz);
	
	void deleteClazzById(int id);
	
	void updateClazz(Clazz clazz);
	
	List<Clazz> findClazzs();
	
	List<Clazz> findClazzsOfMajor(Major major);
	
	Clazz findClazzById(int id);
	
	/*
	 * Course对象的事务处理
	 */
	void saveCourse(Course course);
	
	void deleteCourseById(int id);
	
	void updateCourse(Course course);
	
	List<Course> findCourses();
	
	List<Course> findCoursesOfMajor(Major major);
	
	List<Course> findCoursesOfType(int id);
	
	Course findCourseById(int id);
	
	Course findCourseByCourseId(String courseId);
	
	/*
	 * Major对象的事务处理
	 */
	void saveMajor(Major major);
	
	void deleteMajorById(int id);
	
	void updateMajor(Major major);
	
	List<Major> findMajors();
	
	List<Major> findMajorsOfDept(Department dept);
	
	Major findMajorById(int id);
	
	Major findMajorByMajorId(String majorId);
	/*
	 * Term对象的事务处理
	 */
	void saveTerm(Term term);
	
	void deleteTermById(int id);
	
	void updateTerm(Term term);
	
	List<Term> findTerms();
	
	Term findTermById(int id);

	//获得当前学期对象
	Term findTermOfNow();
	
	//通过学年度开始年和结束年以及学期序号查找学期对象
	Term findTermByTimeAndOrder(int startYear, int endYear,int order);
	
	/*
	 * Teacher对象的事务处理
	 */
	void saveTeacher(Teacher teacher);
	
	void deleteTeacherById(int id);
	
	void updateTeacher(Teacher teacher);
	
	List<Teacher> findTeachers();
	
	List<Teacher> findTeachersOfDept(Department dept);
 	
	Teacher findTeacherById(int id);
	
	Teacher findTeacherByUserId(int id);
	
	Teacher findTeacherByTeachId(String id);

	/*
	 * Student对象的事务处理
	 */
	void saveStudent(Student student);
	
	void deleteStudentById(int id);
	
	void updateStudent(Student student);
	
	List<Student> findStudents();
	
	Student findStudentById(int id);

	Clazz findClazzByClazzId(String clazzId);
	
	Student findStudentByStuId(String id);
}
